#include <windows.ui.xaml.media.dxinterop.h>
#include "GraphicsDeviceContext.h"

ref class XamlSurfaceRenderer sealed : xamlImaging::SurfaceImageSource
{
public:
    virtual ~XamlSurfaceRenderer();
internal:
    XamlSurfaceRenderer(GraphicsDeviceContextPtr const& gfx, Dx::SizeU const pixelSize, bool isOpaque);
internal:
    void BeginDraw (dxgi::Surface& surface, Dx::Point2F& offset) const;
    void EndDraw   () const;
    auto GetSize   () const -> Dx::SizeU;
private:
    void CreateDeviceIndependentResources();
    void CreateDeviceResources();
private:
    ISurfaceImageSourceNativeWithD2D* m_sisNative;
    GraphicsDeviceContextPtr          m_gfx;
    Dx::SizeU                         m_pixelSize;
};
